<template>
  <div class="CountingTask">
    <el-main>
      <div>
        <el-form ref="form" :model="form" label-width="100px">
          <el-row :gutter="20">
            <el-col :span="12">
              <div class="grid-content bg-purple">
                <el-form-item label="盘点单状态">
                  <el-select v-model="form.assetType" placeholder="全部">
                    <el-option label="全部" value="Houses"></el-option>
                    <el-option label="已完成" value="FlexibleUnit"></el-option>
                    <el-option label="未完成" value="SpecialEquipment"></el-option>
                  </el-select>
                </el-form-item>
              </div>
            </el-col>
            <!-- <el-col :span="12">
            <div class="grid-content bg-purple">-->
            <div class="block">
              <span class="demonstration">购入日期:</span>
              <el-date-picker
                v-model="value6"
                type="daterange"
                range-separator="-"
                start-placeholder="开始日期"
                end-placeholder="结束日期"
              ></el-date-picker>
              <el-button icon="el-icon-search"></el-button>
            </div>
            <!--  </div>
            </el-col>-->
          </el-row>
          <el-row :gutter="20">
            <el-col :span="12">
              <div class="grid-content bg-purple">
                <el-button type="primary" icon="el-icon-view" :plain="true" @click="open">开始盘点</el-button>
                <el-button type="primary" icon="el-icon-edit">编辑</el-button>
                <el-button type="danger" icon="el-icon-delete" :plain="true" @click="open4">删除</el-button>
              </div>
            </el-col>
          </el-row>
        </el-form>
      </div>
      <el-table
        ref="multipleTable"
        :data="tableData3"
        border
        tooltip-effect="dark"
        style="width: 100%"
        @selection-change="handleSelectionChange"
      >
        <el-table-column type="selection" width="55"></el-table-column>
        <el-table-column prop="State" label="盘点状态" style="width: 20%"></el-table-column>
        <el-table-column prop="pictureUrl" label="盘点名称" style="width: 20%">
          <el-button type="text" @click="dialogFormVisible = true">123 Dialog</el-button>
        </el-table-column>
        <el-table-column prop="assetCode" label="创建时间" style="width: 20%"></el-table-column>
        <el-table-column prop="assetName" label="创建人" style="width: 20%"></el-table-column>
        <el-table-column prop="standardType" label="操作" style="width: 20%"></el-table-column>
      </el-table>
      <el-dialog title="盘点任务单" :visible.sync="dialogFormVisible" style="width:120%">
        <el-form :model="form">
          <el-row>
            <el-col :span="12">
              <div class="grid-content bg-purple">
                <el-form-item label="盘点单名称" :label-width="formLabelWidth">
                  <el-input v-model="form.name" auto-complete="off"></el-input>
                </el-form-item>
              </div>
            </el-col>
            <el-col :span="12">
              <div class="grid-content bg-purple-light">
                <el-form-item label="分配用户" :label-width="formLabelWidth">
                  <el-input v-model="form.name" auto-complete="off"></el-input>
                </el-form-item>
              </div>
            </el-col>
          </el-row>
          <hr>
          <br>
          <span>待盘点任务单</span>
          <el-table :data="gridData">
            <el-table-column property="date" label="状态"></el-table-column>
            <el-table-column property="name" label="资产编号"></el-table-column>
            <el-table-column property="address" label="资产名称"></el-table-column>
            <el-table-column property="date" label="使用部门"></el-table-column>
            <el-table-column property="name" label="使用人"></el-table-column>
            <el-table-column property="address" label="购入时间"></el-table-column>
            <el-table-column property="date" label="所属公司"></el-table-column>
            <el-table-column property="name" label="管理员"></el-table-column>
          </el-table>
        </el-form>
        <div slot="footer" class="dialog-footer">
          <el-button @click="dialogFormVisible = false">取 消</el-button>
          <el-button type="primary" @click="dialogFormVisible = false">确 定</el-button>
        </div>
      </el-dialog>
      <div class="block">
        <el-row :gutter="20">
          <el-col :span="4">
            <div class="grid-content bg-purple">
              <!-- <span class="demonstration">已选择0条</span> -->
            </div>
          </el-col>
          <el-col :span="10">
            <div class="grid-content bg-purple">
              <el-pagination
                @size-change="handleSizeChange"
                @current-change="handleCurrentChange"
                :current-page="currentPage4"
                :page-sizes="[10, 20, 30, 40]"
                :page-size="10"
                layout="prev, pager, next, sizes, jumper"
                :total="400"
              ></el-pagination>
            </div>
          </el-col>
        </el-row>
      </div>
    </el-main>
  </div>
</template>
<script>
export default {
  data() {
    return {
      form: {
        assetType: "",
        assetName: "",
        department: ""
      },
      tableData3: [
        {
          State: "在用",
          pictureUrl: "",
          assetCode: "123456",
          assetName: "奔驰"
        },
        {
          State: "报废",
          pictureUrl: "",
          assetCode: "123456",
          assetName: "奔驰"
        },
        {
          State: "闲置",
          pictureUrl: "",
          assetCode: "123456",
          assetName: "奔驰"
        },
        {
          State: "在用",
          pictureUrl: "",
          assetCode: "123456",
          assetName: "奔驰"
        },
        {
          State: "在用",
          pictureUrl: "",
          assetCode: "123456",
          assetName: "奔驰"
        },
        {
          State: "在用",
          pictureUrl: "",
          assetCode: "123456",
          assetName: "奔驰"
        },
        {
          State: "在用",
          pictureUrl: "",
          assetCode: "123456",
          assetName: "奔驰"
        }
      ],
      gridData: [
        {
          State: "在用",
          pictureUrl: "",
          assetCode: "123456",
          assetName: "奔驰"
        },
        {
          State: "报废",
          pictureUrl: "",
          assetCode: "123456",
          assetName: "奔驰"
        },
        {
          State: "闲置",
          pictureUrl: "",
          assetCode: "123456",
          assetName: "奔驰"
        },
        {
          State: "在用",
          pictureUrl: "",
          assetCode: "123456",
          assetName: "奔驰"
        },
      ],
      value6: "",
      currentPage1: 5,
      currentPage2: 5,
      currentPage3: 5,
      currentPage4: 4,
      multipleSelection: [],
      dialogTableVisible: false,
      dialogFormVisible: false,
      form: {
        name: "",
        region: "",
        date1: "",
        date2: "",
        delivery: false,
        type: [],
        resource: "",
        desc: ""
      },
      formLabelWidth: "120px"
    };
  },
  methods: {
    toggleSelection(rows) {
      if (rows) {
        rows.forEach(row => {
          this.$refs.multipleTable.toggleRowSelection(row);
        });
      } else {
        this.$refs.multipleTable.clearSelection();
      }
    },
    handleSelectionChange(val) {
      this.multipleSelection = val;
    },
    handleSizeChange(val) {
      console.log(`每页 ${val} 条`);
    },
    handleCurrentChange(val) {
      console.log(`当前页: ${val}`);
    },
    open() {
      this.$message("请至少选择一条盘点任务");
    },
    open4() {
      this.$message.error("已盘点的数据不能删除!");
    }
  }
};
</script>
<style lang="scss" scoped>
</style>
